﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AlgorithmResult;

namespace TripletSegmentationGUI
{
    public partial class GeneticAlgorithmParamsUI : UserControl
    {
        public GeneticAlgorithmParamsUI()
        {
            InitializeComponent();
            alphanumericUpDown1.DecimalPlaces = 2;
            alphanumericUpDown1.Increment = 0.01M;
        }

        private void NumTopIndviduals_ValueChanged(object sender, EventArgs e)
        {

        }
        delegate void setMaximumValueForProgresBarCB(int value);
        public void setMaximumValueForProgresBar(int value)
        {
            if (this.InvokeRequired)
            {
                setMaximumValueForProgresBarCB d = setMaximumValueForProgresBar;
                this.Invoke(d, new object[] { value });
                return;
            }
            IndividualCreatorprogressBar.Maximum = (int)value;
       
        }
        delegate void UpadateGeneticAlgIdividualCB(object sender, progressEvent eventProgress);
        public void UpadateGeneticAlgIdividualCreation(object sender, progressEvent eventProgress)
        {
            if (this.InvokeRequired)
            {
                UpadateGeneticAlgIdividualCB d = UpadateGeneticAlgIdividualCreation;
                this.Invoke(d, new object[] { sender, eventProgress });
                return;
            }

            int value = (int)(10000 * ((double)(eventProgress.Index) / (double)PopulationSize.Value));
            if (IndividualCreatorprogressBar.Value != value)
            {
                IndividualCreatorprogressBar.Value = value;
                IndividualCreatorprogressBar.Refresh();
                progresslabelIndividualCreation.Text = (IndividualCreatorprogressBar.Value / 100).ToString();
                progresslabelIndividualCreation.Refresh();
            }

        }
        private void button1_Click(object sender, EventArgs e)
        {

            errorProvider1.SetError(button1, "Not implemented yet");

        }
    }
}
